*****************************************
***MEDIA PROMINENCE OF INTEREST GROUPS***
*****************************************
*Evelien Willems 
*University of Antwerp
*Paper published in JMCQ

*Note: layout and labels of Tables & Figures is adjusted manually

*****************************************
*******DESCRIPTIVE STATISTICS************
*************MAIN ARTICLE****************
*****************************************

***only organisational characteristics***

*set Working directory where files are located

 use media_prominence_org.dta
 
 set more off
 
*Figure 1 - Average number of groups in the news across domains by salience and political contestation
**Own calculations in Excel

*Figure 2 - Boxplots of media prominence by media strategy intensity 
graph box energy_overall_adj, over(attention_cat) yscale(range(0 2.5)) ylabel(0(0.5)2.5) ytitle("Intensity of media strategies") b1title("Degree of prominence") box(1, color("grey30%"))

*****************************************
**REGRESSION ANALYSES & POST-ESTIMATION**
*************MAIN ARTICLE****************
*****************************************

*Table 2 - Ordinal regressions at policy area level, clustered SEs by organization
 **Model 1
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.energy, vce(cluster Org_ID)
 fitstat
 est store model1
 
 **Model 2
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.energy polcon energyPD, vce(cluster Org_ID)
 fitstat
 est store model2

 **Model 3
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.energy polcon energyPD news_sal pub_priority, vce(cluster Org_ID)
 fitstat
 est store model3
   
 *testing multicollinearity
 collin staff_cent memact_cent polcon energyPD news_sal pub_priority 
 pwcorr staff_cent memact_cent polcon energyPD news_sal pub_priority, sig
 
 **Model 4
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.energy polcon energyPD c.pub_priority##c.news_sal, vce(cluster Org_ID)
 fitstat
 est store model4
 
 **Regression table output
 esttab model1 model2 model3 model4 using "media prominence_ordPD.rtf", cells(b(star fmt(3)) se(par fmt(2)))  legend label noabbrev stats(N df_m chi2 p r2_p, fmt(0 0 3 2 3) label("N" "df" "Wald Chi2" "p")) varwidth(26) replace rtf nobaselevels ///
mtitles("Model1")   mtitle nonumbers 

**************************
***with issue positions***
**************************

*Set working directory to where file is located
 
 use media_prominence_position.dta
 
*Table 2 - Ordinal regressions at issue level, clustered SEs by organization
 **Model 1
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.outside_cat, vce(cluster Org_ID)
 est store model1
 fitstat
 
 **Model 2
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.outside_cat i.statusquo contest_cent energy_cent i.juris, vce(cluster Org_ID)
 est store model2
 fitstat
 
 **Model 3
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.outside_cat i.statusquo contest_cent energy_cent i.juris congruence_cent salience_all_log_cent, vce(cluster Org_ID)
 est store model3
 fitstat
 
 *Predicted probabilities for prominence 3+ by salience 
 margins, at(c.salience_all_log_cent=(-1 1)) predict(outcome(3)) asobserved vce(unconditional) vsquish
 
 *Public support uncentered for intuitive explaining of marginal effects
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.outside_cat i.statusquo contest_cent energy_cent i.juris congruence salience_all_log_cent, vce(cluster Org_ID)
 est store model3
 fitstat
 
 *Predicted probablities for prominence 3+ by public support 
 margins, at(c.congruence=(0 (5) 100)) predict(outcome(3)) asobserved vce(unconditional) vsquish
 
 **Model 4
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.outside_cat i.statusquo contest_cent energy_cent i.juris c.congruence_cent##c.salience_all_log_cent, vce(cluster Org_ID)
 est store model4
 fitstat
 
 **Regression table output
esttab model1 model2 model3 model4 using "media prominence_ordIssue.rtf", cells(b(star fmt(3)) se(par fmt(2)))  legend label noabbrev stats(N df_m chi2 p r2_p, fmt(0 0 3 2 3) label("N" "df" "Wald Chi2" "p")) varwidth(26) replace rtf nobaselevels ///
mtitles("Model1" "Model2" "Model3" "Model4")   mtitle nonumbers 


*Figure 3 - Predicted probabilities
 *Public support uncentered for plotting purposes
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.outside_cat i.statusquo contest_cent energy_cent i.juris c.congruence##c.  salience_all_log_cent, vce(cluster Org_ID)
 est store model4
 fitstat
 
 *outcoume 1
margins, at(c.congruence=(0 (5) 100) c.salience_all_log_cent=(-1 1)) predict(outcome(1)) asobserved vce(unconditional) vsquish
marginsplot, //// 
level(95) /// confidence intervals
plotregion(fcolor(white) lcolor(gs10) lwidth(med)) /// background coloration and outline
xlabel("0 10 20 30 40 50 60 70 80 90 100",  /// x-axis label  
labcolor(black) tlcolor() tlwidth(thin) labsize(small) nogrid)  /// x-axis labels coloration   
xtitle("Degree of public support", color(black)) /// x-axis title
ytitle("Pr(Low prominence)", color(black)) /// y-axis title
title(" ") /// master graph title
recast(line) recastci(rarea) ciopts(fintensity(10)) plotopts(lcolor(black)) /// confidence interval display options
addplot(histogram congruence, /// adding histogram marginsplot graph
blcolor(black) fcolor(gs10) /// bar line and fill colors
discrete percent /// histogram bins in "percent" rather than "discrete" (actual)
 yaxis(2) /// calls for 2nd y-axis
yscale(alt lcolor(black) axis(2)) /// scaling on 2nd y-axis
 ylabel("0 40", /// minimizing the height of histogram
labcolor(black) axis(2) tlcolor(black) tlwidth(thin) labsize(small)) /// label options on 2nd y-axis
ytitle(" ", axis(2)) /// telling Stata to remove title on 2nd y-axis
legend(order( 1 "Low salience" 2 "High salience"))) ///
name(predprob1, replace)
graph export Figure3_1.png, replace

*outcoume 3+
margins, at(c.congruence=(0 (5) 100) c.salience_all_log_cent=(-1 1)) predict(outcome(3)) asobserved vce(unconditional) vsquish
marginsplot, //// 
level(95) /// confidence intervals
plotregion(fcolor(white) lcolor(gs10) lwidth(med)) /// background coloration and outline
xlabel("0 10 20 30 40 50 60 70 80 90 100",  /// x-axis label  
labcolor(black) tlcolor() tlwidth(thin) labsize(small) nogrid)  /// x-axis labels coloration   
xtitle("Degree of public support", color(black)) /// x-axis title
ytitle("Pr(High prominence)", color(black)) /// y-axis title
title(" ") /// master graph title
recast(line) recastci(rarea) ciopts(fintensity(10)) plotopts(lcolor(black)) /// confidence interval display options
addplot(histogram congruence, /// adding histogram marginsplot graph
blcolor(black) fcolor(gs10) /// bar line and fill colors
discrete percent /// histogram bins in "percent" rather than "discrete" (actual)
 yaxis(2) /// calls for 2nd y-axis
yscale(alt lcolor(black) axis(2)) /// scaling on 2nd y-axis
 ylabel("0 40", /// minimizing the height of histogram
labcolor(black) axis(2) tlcolor(black) tlwidth(thin) labsize(small)) /// label options on 2nd y-axis
ytitle(" ", axis(2)) /// telling Stata to remove title on 2nd y-axis
legend(order( 1 "Low salience" 2 "High salience"))) ///
name(predprob3, replace)
graph export Figure3_2.png, replace

graph combine predprob1 predprob3, ycommon
 

*****************************************
**************APPENDIX*******************
*****************************************

**************************
***only organisational characteristics***
**************************

*set Working directory where files are located

 use media_prominence_org.dta
 
 set more off
 
*Table A.3 - Descriptive statistics
summarize staff memact AdEnergy contestation_percentage ees_log SAL_PD
codebook attention_cat type3 access_cat energy

*Figure A.4 - Percentage of claims per group type by policy area
*Own calculations in Excel

*Table A.4 - ANOVA and Tukey post hoc results
ttest staff, by(energy)

oneway energy_overall_adj attention_cat, tabulate
pwmean energy_overall_adj, over(attention_cat) mcompare(tukey) effects

*Table A.5 - Zero-inflated Poisson regression with clustered standard errors at policy area level
 zip attention_cat b1.type3 i.access_cat staff_cent memact_cent b1.energy energyPD polcon pub_priority news_sal, inflate(b1.energy) vce(cluster Org_ID)
 fitstat
 est store model1
 
 **Regression table output
esttab model1  using "media prominence_zipPD.rtf", cells(b(star fmt(3)) se(par fmt(2))) legend label noabbrev stats(N df_m chi2 p r2_p, fmt(0 0 3 2 3) label("N" "df" "Wald Chi2" "p")) varwidth(26) replace rtf nobaselevels ///
mtitles("Model1") mtitle nonumbers 

 *Post-estimation
predict p, pr
table energy, statistic(mean p)
 *Predicted probability of being an excessive zero decreases the more intensely IGs use media strategies
 
 *Predicted count of media appearances for different levels of media salience
 margins, at(news_sal=(-0.5(0.1)1.5))
 marginsplot, title("") ytitle("Predicted count of media appaerances") xtitle("Degree of salience") xlabel(-0.5(0.5)1.5) recastci(rarea) ci1opts(fintensity(10)) name(m2a, replace)
 *overall: low predicted count, but positive effect of salience

 **Testing model fit
 zinb attention_cat b1.type3 i.access_cat staff_cent memact_cent b1.energy energyPD polcon pub_priority news_sal, inflate(b1.energy) vce(cluster Org_ID)
 est store model1
 
 nbreg attention_cat b1.type3 i.access_cat staff_cent memact_cent b1.energy energyPD polcon pub_priority news_sal, vce(cluster Org_ID)
 
 countfit attention_cat type3 access_cat staff_cent memact_cent pub_priority news_sal energyPD polcon, inflate(energy) zinb nbreg zip

**************************
***with issue positions***
**************************

*set Working directory where files are located 

 use media_prominence_position.dta
 
 set more off
 
*Table A.3 - Descriptive statistics
summarize staff memact congruence salience_all_log contest AdEnergy
codebook attention_cat type3 access_cat outside_cat statusquo juris
 
*Figure A.5 - Boxplots of public support by media prominence per group type
label define type_b 1 "concentrated" 2 "representative diffuse" 3 "solidarity"
label values type3 type_b 

graph box congruence, over(attention_cat) by(type3) yscale(range(0 100)) ylabel(0(20)100) ytitle(Public support) box(1, bcolor("grey30%")) marker(1, mcolor("grey30%")) 

*Figure A.6 - Average Marginal Effects of Salience with 95% CIs
 *first run the interaction model (Model 4 - Table 2 main text)
 ologit attention_cat b1.type3 i.access_cat staff_cent memact_cent i.outside_cat i.statusquo contest_cent energy_cent i.juris c.congruence##c.salience_all_log_cent, vce(cluster Org_ID)
 est store model4
 fitstat
 
 *An additional newspaper article about an issue, increases/decreases the probability of 1/2/3+ media appearances by XXX when moving from little public support to broad public support
 margins, dydx(salience_all_log_cent) at(congruence==(0(5)100))  predict(outcome(1)) vce(unconditional) 
 marginsplot, title("") ytitle("Effects on Pr(Low prominence") yline(0, lstyle(foreground) lcolor(red) lpattern(dash)) recast(line) recastci(rarea) ci1opts(fintensity(10)) level(95) xtitle("Degree of public support") name(plot1, replace)

 margins, dydx(salience_all_log_cent) at(congruence==(0(5)100))  predict(outcome(2)) vce(unconditional) 
 marginsplot, title("") ytitle("Effects on Pr(Medium prominence") yline(0, lstyle(foreground) lcolor(red) lpattern(dash)) recast(line) recastci(rarea) ci1opts(fintensity(10)) level(95) xtitle("Degree of public support") name(plot2, replace)

 margins, dydx(salience_all_log_cent) at(congruence==(0(5)100))  predict(outcome(3)) vce(unconditional) 
 marginsplot, title("") ytitle("Effects on Pr(High prominence") yline(0, lstyle(foreground) lcolor(red) lpattern(dash)) recast(line) recastci(rarea) ci1opts(fintensity(10)) level(95) xtitle("Degree of public support") name(plot3, replace)

 graph combine plot1 plot2 plot3, ycommon cols(3) altshrink ysize(2.7) 
  